const Blockchain = require('./blockchain');
const bitcoin = new Blockchain();

const bc1 = {
    "chain": [
      {
        "index": 1,
        "timestamp": 1718457001922,
        "transactions": [],
        "nonce": 0,
        "previous_block_hash": "0",
        "hash": "0"
      },
      {
        "index": 2,
        "timestamp": 1718457013878,
        "transactions": [],
        "nonce": 192133,
        "previous_block_hash": "0",
        "hash": "000073e7d35d35be0861f043cae54db47715fe0d145fd49bd5964140949f2a31"
      },
      {
        "index": 3,
        "timestamp": 1718457055449,
        "transactions": [
          {
            "amount": 12.5,
            "sender": "00",
            "recipient": "b4050988ae5646f1b9cf4d371df4038e",
            "transaction_id": "63cd852214504f8bae0caf1b3f04d328"
          }
        ],
        "nonce": 145648,
        "previous_block_hash": "000073e7d35d35be0861f043cae54db47715fe0d145fd49bd5964140949f2a31",
        "hash": "000057282ecf751a27686cc6ad750cd40be5dded480849239642137d8c22a39e"
      },
      {
        "index": 4,
        "timestamp": 1718457110351,
        "transactions": [
          {
            "amount": 12.5,
            "sender": "00",
            "recipient": "b4050988ae5646f1b9cf4d371df4038e",
            "transaction_id": "39d03045ab1e4f6b9257f7393980cebb"
          }
        ],
        "nonce": 3182,
        "previous_block_hash": "000057282ecf751a27686cc6ad750cd40be5dded480849239642137d8c22a39e",
        "hash": "0000070ef8a7b156e23c1a57353557ed1eb301a5cfd755d925bbecafb7efd7db"
      },
      {
        "index": 5,
        "timestamp": 1718457122988,
        "transactions": [
          {
            "amount": 12.5,
            "sender": "00",
            "recipient": "b4050988ae5646f1b9cf4d371df4038e",
            "transaction_id": "6ba8c54ded1b4987b271c1925d8530a2"
          }
        ],
        "nonce": 31322,
        "previous_block_hash": "0000070ef8a7b156e23c1a57353557ed1eb301a5cfd755d925bbecafb7efd7db",
        "hash": "0000d74a09d086f32882388429038a1a769ac32be0fc1b39b6764636d0d95c73"
      },
      {
        "index": 6,
        "timestamp": 1718457493516,
        "transactions": [
          {
            "amount": 12.5,
            "sender": "00",
            "recipient": "70bdc1c445954f51b36992b6ad9723d2",
            "transaction_id": "e85773739c9d4e6f8fc2deab51d8b605"
          },
          {
            "amount": 55,
            "sender": "FJDFJ:ADJF",
            "recipient": "XNASKJDLJASKF",
            "transaction_id": "7d7a414883ba4b67be6aac5824da4008"
          }
        ],
        "nonce": 40006,
        "previous_block_hash": "0000d74a09d086f32882388429038a1a769ac32be0fc1b39b6764636d0d95c73",
        "hash": "0000904692447825a010c961b329b2bb030418ffe5ff8eb2a9992209dfe8ef9b"
      }
    ],
    "pending_transactions": [
      {
        "amount": 12.5,
        "sender": "00",
        "recipient": "70bdc1c445954f51b36992b6ad9723d2",
        "transaction_id": "0d1d6d896434440d91a992c388e52225"
      }
    ],
    "node_url": "http://localhost:3001",
    "network_nodes": [
      "http://localhost:3003",
      "http://localhost:3002"
    ]
  };


console.log(bitcoin.isChainValid(bc1.chain));